package cn.hhchat.wp.repository;

import cn.hhchat.wp.entity.RoleEntity;
import cn.hhchat.wp.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * Created this one by HMH on 2017/10/22.
 */
public interface UserRepository extends JpaRepository<UserEntity, Long> {

    UserEntity findByUsername(String username);

    UserEntity findByEmail(String email);

    int countAllBy();

    UserEntity findByEmailOrUsername(String email, String username);

    List<UserEntity> findByRolesContains(RoleEntity role);

}
